home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / SYSTEM.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  436 b   |  21 lines

  1. /* system.c--- BIBLE pp. 103-104 */
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. main()
  5. {
  6.     char command[80];
  7.     while(1)
  8.     {
  9.         printf("Enter command (\"quit\" to exit):");
  10.         gets(command);
  11.         strlwr(command);
  12.                                             /* Exit if user typed "quit" */
  13.         if(strcmp(command, "quit") == 0)
  14.             exit(0);
  15.             /* Otherwise pass command to a copy of COMMAND.COM */
  16.         if(system(command) == 1)
  17.         {
  18.             perror("error in system");
  19.         }
  20.     }
  21. }